package com.sc.nft.controller;

import com.sc.nft.annotation.UserLogin;
import com.sc.nft.entity.dto.ListDetailsListDTO;
import com.sc.nft.entity.dto.UserIndependentListDTO;
import com.sc.nft.entity.vo.ListDetailsListVO;
import com.sc.nft.entity.vo.UserIndependentListVO;
import com.sc.nft.pool.UserPool;
import com.sc.nft.service.RankingBoardDetailsNumberService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/rankingBoardDetailsNumber")
@Api(tags = "排行表列表")
public class RankingBoardDetailsNumberController {

    private final RankingBoardDetailsNumberService rankingBoardDetailsNumberService;

    @ApiOperation(value = "榜单详情列表", notes = "榜单详情列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/listDetailsList", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public PageResult<ListDetailsListVO> listDetailsList(@Validated @RequestBody ListDetailsListDTO listDetailsListDTO) {
        return PageResult.success(rankingBoardDetailsNumberService.listDetailsList(listDetailsListDTO));
    }

    @ApiOperation(value = "用户独立榜单", notes = "用户独立榜单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/userIndependentList", produces = MediaType.APPLICATION_JSON_VALUE)
    @UserLogin
    public Result<UserIndependentListVO> userIndependentList(@Validated @RequestBody UserIndependentListDTO userIndependentListDTO) {
        return Result.success(rankingBoardDetailsNumberService.userIndependentList(userIndependentListDTO, UserPool.getUser()));
    }
}
